import {SubmitRegiterInfo} from '../http/httpFunction'

export default {
    namespaced:true,
    actions:{
        async regiterRequest(content,val){
            if(val.username === '' || val.password === ''){
                content.commit('REGITERREQUEST','账号或密码不可为空')
                return
            }else{
                const result = await SubmitRegiterInfo(val.username,val.password)
                console.log(result.data)
                content.commit('REGITERREQUEST',result.data.msg)
            }
        }
    },
    mutations:{
        REGITERREQUEST(state,val){
            state.regiterMsg = val
            state.upBoxisShow = true
            setTimeout(()=>{
                state.upBoxisShow = false
                state.regiterMsg = ''
            },1000)
        }
    },
    state:{
        regiterMsg:"",
        upBoxisShow:false,
    }
}